<ix-fieldset [title]="'Source' | translate" [formGroup]="form">
  <ix-explorer
    formControlName="source_datasets"
    [label]="'Source' | translate"
    [rootNodes]="[emptyRootNode]"
    [required]="true"
    [multiple]="true"
    [tooltip]="helptext.sourceDatasetsTooltip | translate"
    [nodeProvider]="nodeProvider()"
  ></ix-explorer>
  @if (!form.value.replicate) {
    <ix-checkbox
      formControlName="recursive"
      [label]="'Recursive' | translate"
      [tooltip]="helptext.recursiveTooltip | translate"
    ></ix-checkbox>
    @if (form.value.recursive) {
      <ix-chips
        formControlName="exclude"
        [label]="'Exclude Child Datasets' | translate"
        [tooltip]="helptext.excludeTooltip | translate"
      ></ix-chips>
    }
    <ix-checkbox
      formControlName="properties"
      [label]="'Include Dataset Properties' | translate"
      [tooltip]="helptext.propertiesTooltip | translate"
    ></ix-checkbox>
  }
  <ix-checkbox
    formControlName="replicate"
    [label]="'Full Filesystem Replication' | translate"
    [tooltip]="helptext.replicateTooltip | translate"
  ></ix-checkbox>
  @if (form.value.replicate || form.value.properties) {
    <ix-chips
      formControlName="properties_override"
      [label]="'Properties Override' | translate"
      [tooltip]="helptext.propertiesOverrideTooltip | translate"
    ></ix-chips>
  }
  @if (form.value.replicate || form.value.properties) {
    <ix-chips
      formControlName="properties_exclude"
      [label]="'Properties Exclude' | translate"
      [tooltip]="helptext.propertiesExcludeTooltip | translate"
    ></ix-chips>
  }
  @if (isPush()) {
    <ix-select
      formControlName="periodic_snapshot_tasks"
      [label]="'Periodic Snapshot Tasks' | translate"
      [options]="periodicSnapshotTasks$"
      [multiple]="true"
      [tooltip]="helptext.periodicSnapshotTasksTooltip | translate"
    ></ix-select>
  }
  <ix-checkbox
    formControlName="restrict_schedule"
    [label]="'Replicate Specific Snapshots' | translate"
    [tooltip]="helptext.restrictScheduleTooltip | translate"
  ></ix-checkbox>
  @if (form.value.restrict_schedule) {
    <ix-scheduler
      formControlName="restrict_schedule_picker"
      [label]="'By snapshot creation time' | translate"
      [startTime]="form.value.restrict_schedule_begin"
      [endTime]="form.value.restrict_schedule_end"
      [tooltip]="helptext.restrictSchedulePickerTooltip | translate"
    ></ix-scheduler>
    @if (form.value.restrict_schedule_picker === CronPresetValue.Hourly) {
      <ix-select
        formControlName="restrict_schedule_begin"
        [label]="'Begin' | translate"
        [options]="timeOptions$"
        [tooltip]="helptext.restrictScheduleBeginTooltip | translate"
      ></ix-select>
    }
    @if (form.value.restrict_schedule_picker === CronPresetValue.Hourly) {
      <ix-select
        formControlName="restrict_schedule_end"
        [label]="'End' | translate"
        [options]="timeOptions$"
        [tooltip]="helptext.restrictScheduleEndTooltip | translate"
      ></ix-select>
    }
  }
  <ix-radio-group
    formControlName="schema_or_regex"
    [label]="nameOrRegexLabel()"
    [options]="snapshotNamingOptions$"
  ></ix-radio-group>
  @if (usesNamingSchema && !isPush()) {
    <ix-chips
      formControlName="naming_schema"
      [label]="'Matching naming schema' | translate"
      [tooltip]="helptext.namingSchemaTooltip | translate"
    ></ix-chips>
  }
  @if (usesNamingSchema && isPush()) {
    <ix-chips
      formControlName="also_include_naming_schema"
      [label]="'Also Include Naming Schema' | translate"
      [tooltip]="helptext.alsoIncludeNamingSchemaTooltip | translate"
    ></ix-chips>
  }
  @if (!usesNamingSchema) {
    <ix-input
      formControlName="name_regex"
      [label]="'Matching regular expression' | translate"
      [tooltip]="helptext.nameRegexTooltip | translate"
    ></ix-input>
  }
  <ix-checkbox
    formControlName="hold_pending_snapshots"
    [label]="'Save Pending Snapshots' | translate"
    [tooltip]="helptext.holdPendingSnapshotsTooltip | translate"
  ></ix-checkbox>
</ix-fieldset>
